﻿using BestEasyCMS.Core.NPoco;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using StructureMap;

namespace BestEasyCMS.Web.MvcUI.Tests
{
    [TestClass]
    public class UnitTest1
    {
        private readonly IDbBase _dbBase;

        public UnitTest1()
        {
            BootStrapper.ConfigureDependencies();
            _dbBase = ObjectFactory.GetInstance<DbBase>();
        }

        [TestMethod]
        public void CreateTable()
        {
            const string createTableSql = @"
                    if exists(select * from sysobjects where name='stuMarks')
                        drop table stuMarks
                    create table stuMarks
                    (
                        ExamNo      int     identity(1,1) primary key,
                        stuNo       char(6) not null,
                        writtenExam int     not null,
                        LabExam     int     not null
                    )";
            var result = _dbBase.Execute(createTableSql);
            Assert.IsTrue(result == -1);
        }
    }
}
